
// 1.获取用户信息,数据回填
function renderUser() {
    $.ajax({
        url: '/my/user/userinfo',
        success: function (res) {
            console.log(res);
            let form = layui.form
            form.val('abc', res.data)
        }
    })
}
renderUser()

// 2.确认修改信息
$('.layui-form').on('submit', function (e) {
    e.preventDefault()
    let data = $(this).serialize()
    $.ajax({
        type: 'POST',
        url: '/my/user/userinfo',
        data: data,
        success: function (res) {
            if (res.status === 0) {
                layer.msg(res.message, {icon: 1})
                window.parent.getUserInfo()
            }
        }
    })
})
// 3.重置页面
$('.layui-btn-primary').on('click', function () {
    renderUser()
})
